<!DOCTYPE html>
<html>
<head>
    <title>微信设置</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="木兰湾管理系统">
    <script type="text/javascript" src="../../static/include/header-css.js"></script>
    <script type="text/javascript">

    </script>
</head>
<body>

<div class="weui-cells__title" align="center">
    <br>
    <label> <h3>微信公众号信息</h3></label>
    <div id="wechatQr" class='tcenter'><img src="../../static/image/wechatqr.jpg"></div>
    <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_warn" onclick="isfollowqr('http://open.weixin.qq.com/qr/code?username=fenghongtravel',true,'微信公众号','关注')">弹出</a>

    <br>
    <br>
    <label id="openId"></label>
    <br>
    <a href="javascript:getWxAppInfo();" class="weui-btn weui-btn_mini weui-btn_primary"><label id="edit-button-name">点我</label></a>
</div>

<br>
<br>
<br>
<script type="text/javascript" src="../../static/include/footer-js.js"></script>
<!--二维码-->
<script type="text/javascript" src="../../static/js/php.js"></script>
<script>
    $(function() {
        getWxUserInfo();
    });
    function getWxUserInfo(){
        var url = '/wechat/getUserWxpayInfo';
        doAjax(null, url, 'GET',false, function(data) {
            if(data){
                setElementInnerHTML('openId','我的编号:'+data.openId.substring(0,4)+'****');
                if(data.subscribe==true){
                    setElementInnerHTML('edit-button-name','已经关注');
                }else{
                    setElementInnerHTML('edit-button-name','还未关注');
                }
            }else{
                showProgress('尚未绑定微信,正在转向绑定...');
                getOpenIdUrl();
            }
        });
    }
    function getWxAppInfo(){
        var url = '/wechat/getWxAppInfo';
        doAjax(null, url, 'GET',false, function(data) {
            window.location.href=data.oaUrl;
        });
    }
    function getOpenIdUrl() {
        var url = '/wechat/wx_auth_access_url';
        var para={
            scope:'snsapi_base',
            redirectUri:document.location.href,
            state:123
        };
        doAjax2(para, url, 'GET',false,false, function(data) {
            window.location.href=data;
        });
    }
</script>
</body>
</html>